@extends('admin.public')

@section('content')
    @if(!empty($ordernum))
        <div class="col-md-12">
            <section class="panel panel-default text-sm doc-buttons">
                <div class="panel-body">
                    <a href="{{ route('admin.workorder.add') }}" class="btn btn-info"><i
                                class="icon-plus ico"></i>
                        &nbsp; 提交工单</a>
                </div>
            </section>
        </div>
    @endif

    <div class="col-md-12">
        <!-- .accordion -->
        <div class="panel-group m-b" id="accordion2">
            @if(!empty($workorderList))
                @foreach($workorderList as $k => $value)
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2"
                               href="#collapse{{ $k }}">
                                {{ $value['order'] }}
                                {!! (bool)$value['jiaji']?'<i class="text-danger icon-fire ico" title="加急"></i>':'' !!}
                                @if($value['status'] == 0)
                                    <a class="btn btn-xs btn-danger pull-right"
                                       href="{{ route('admin.workorder.index',$value['id']) }}">正在处理</a>
                                @elseif($value['status'] == 1)
                                    <a class="btn btn-xs btn-danger pull-right"
                                       href="{{ route('admin.workorder.index',$value['id']) }}">处理完成</a>
                                @elseif($value['status'] == 2)
                                    <a class="btn btn-xs btn-danger pull-right disabled" href="">处理完成</a>
                                @endif
                            </a>
                        </div>
                        <div id="collapse{{ $k }}" class="panel-collapse {{ $k==0?'in':'collapse' }}">
                            <div class="panel-body text-sm">
                                <p class="text-success">工单简述 : {{ $value['name'] }}</p>
                                <p class="text-success">客户联系方式 : {{ $value['connect'] }}</p>
                                <p class="text-success">问题类型 : {{ $value['type'] }}</p>
                                @php
                                    switch ($value['status']){
                                        case 0:
                                            $status = '尚未处理';
                                            break;
                                        case 1:
                                            $status = '正在处理';
                                            break;
                                        case 2:
                                            $status = '处理完成';
                                            break;

                                    }
                                @endphp
                                <p class="text-success">当前状态 : {{ $status }}</p>
                                <span class="btn btn-xs btn-success m-b">问题描述</span>
                                {!! $value['describe'] !!}
                                @if(!empty($value['describe_ps']))
                                    <hr>
                                    <p class="btn btn-xs btn-success m-b">补充信息</p>
                                    <div class="clearfix"></div>
                                    {{ $value['describe_ps'] }}
                                @endif
                                @if(empty($value['describe_ps']) && ($value['status'] != 2))
                                    <hr>
                                    <a href="{{ route('admin.workorder.edit',$value['id']) }}"
                                       class="btn btn-xs btn-default">补充信息</a>
                                @endif
                            </div>
                        </div>
                    </div>
                @endforeach
            @endif
        </div>

@endsection

@section('css')
@endsection

@section('js')
@endsection